<template>
  <div class="property-dialog">
    <UserTaskProperty
      v-if="nodeData.type === 'bpmn:userTask'"
      :nodeData="nodeData"
      :lf="lf"
      ref="userTaskProperty"/>
    <SequenceFlowProperty
        v-if="nodeData.type === 'bpmn:sequenceFlow'"
        :nodeData="nodeData"
        :lf="lf"
        ref="sequenceFlowProperty"/>
    <ServiceTaskProperty
        v-if="nodeData.type === 'bpmn:serviceTask'"
        :nodeData="nodeData"
        :lf="lf"
        ref="serviceTaskProperty"/>
    <ProcessProperty
        v-if="nodeData.type=== 'bpmn:process'"
        :nodeData="nodeData"
        @updateParent="updateParent"
        ref="processProperty"/>
    <StartEventProperty
        v-if="nodeData.type=== 'bpmn:startEvent'"
        :nodeData="nodeData"
        :lf="lf"
        @updateParent="updateParent"
        ref="startEventProperty"/>
    <EndEventProperty
        v-if="nodeData.type=== 'bpmn:endEvent'"
        :nodeData="nodeData"
        :lf="lf"
        @updateParent="updateParent"
        ref="endEventProperty"/>
    <GatewayProperty
        v-if="nodeData.type=== 'bpmn:exclusiveGateway'"
        :nodeData="nodeData"
        :lf="lf"
        @updateParent="updateParent"
        ref="gatewayProperty"/>
  </div>
</template>
<script>
import UserTaskProperty from './UserTaskProperty'
import SequenceFlowProperty from "./SequenceFlowProperty";
import ServiceTaskProperty from "./ServiceTaskProperty";
import ProcessProperty from "@/components/myFlow/NodeSetting/ProcessProperty";
import StartEventProperty from "@/components/myFlow/NodeSetting/StartEventProperty"
import EndEventProperty from "@/components/myFlow/NodeSetting/EndEventProperty";
import GatewayProperty from "@/components/myFlow/NodeSetting/GatewayProperty";



export default {
  name: 'NodePropertyDialog',
  components: {
    UserTaskProperty,SequenceFlowProperty,ServiceTaskProperty,ProcessProperty,StartEventProperty,GatewayProperty,EndEventProperty
  },
  props: {
    nodeData: Object,
    lf: Object
  },
  data () {
    return {}
  },
  methods: {
    handleClose () {
      if(this.$props.nodeData.type=="bpmn:userTask") {
        this.$refs.userTaskProperty.save()
      }
      if(this.$props.nodeData.type=="bpmn:sequenceFlow") {
        this.$refs.sequenceFlowProperty.save()
      }
      if(this.$props.nodeData.type=="bpmn:serviceTask") {
        this.$refs.serviceTaskProperty.save()
      }
      if(this.$props.nodeData.type=="bpmn:process") {
        this.$refs.processProperty.save()
      }
      if(this.$props.nodeData.type=="bpmn:startEvent") {
        this.$refs.startEventProperty.save()
      }
      if(this.$props.nodeData.type=="bpmn:endEvent") {
        this.$refs.endEventProperty.save()
      }
      if(this.$props.nodeData.type=="bpmn:exclusiveGateway") {
        this.$refs.gatewayProperty.save()
      }
      this.$emit('setPropertiesFinish')
    },
    updateParent(param){
      this.$emit("updateParent",param)
    }
  }
}
</script>
<style>
.property-dialog{
  padding: 20px;
}
</style>
